import 'package:flutter/material.dart';
import 'package:ost_flutter_module/common/adapt.dart';
import 'package:ost_flutter_module/common/color.dart';

class GContainer extends StatelessWidget {
  final Widget child;
  final EdgeInsetsGeometry padding;
  final Color color;
  final double radius;
  final double height;
  final bool shadow;

  final ShapeBorder shape;
  final VoidCallback onTap;

  const GContainer(
      {Key key,
      this.color = Colors.white,
      this.radius = 10,
      this.onTap,
      this.child,
      this.padding,
      this.height,
      this.shape,
      this.shadow = true})
      : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Ink(
      child: Padding(
        padding: padding ??
            EdgeInsets.only(
                top: Adapt.px(10), left: Adapt.px(10), right: Adapt.px(10)),
        child: Container(
          height: height,
          decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(Adapt.px(radius)),
              boxShadow: shadow
                  ? [
                      BoxShadow(
                        color: Colors.grey.withOpacity(0.2),
                        offset: const Offset(0, 2),
                        blurRadius: Adapt.px(10.0),
                      ),
                    ]
                  : []),
          child: Material(
            color: color,
            elevation: 0.5,
            shadowColor: Colors.grey.withOpacity(0.2),
            borderRadius:
                shape == null ? BorderRadius.circular(Adapt.px(radius)) : null,
            shape: shape,
            child: InkWell(
              borderRadius: BorderRadius.circular(Adapt.px(radius)),
              child: child,
              onTap: () => onTap(),
            ),
          ),
        ),
      ),
    );
  }
}
